package com.cy.pj.common.pool;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;

/**
 * Copyright (C), 2015-2020, XXX有限公司
 * FileName: ObjectPool
 * Author:   ASUS
 * Date:     2020/9/27 14:27
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
@Scope("prototype")
//@Lazy
@Component
public class ObjectPool {
    public ObjectPool(){
        System.out.println("objectPool()");
    }
    @PostConstruct
    public void init(){
        System.out.println("init()");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("destroy()");
    }
    public static void main(String[] age){
        Map<String,Object> beanPool=new HashMap<String, Object>();
        Point p1=new Point();
        Point p2=new Point();
        beanPool.put("point01",p1);
        Point p3=p2;
        p1=null;
        p2=null;
        beanPool.clear();
        System.gc();
    }
}
